
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Event Processors · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../../styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="subscribing.html" />
    
    
    <link rel="prev" href="../event-handlers.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../../architecture-overview/">
            
                <a href="../../../architecture-overview/">
            
                    
                    Architecture Overview
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../../architecture-overview/ddd-cqrs-concepts.html">
            
                <a href="../../../architecture-overview/ddd-cqrs-concepts.html">
            
                    
                    DDD & CQRS Concepts
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../../architecture-overview/event-sourcing.html">
            
                <a href="../../../architecture-overview/event-sourcing.html">
            
                    
                    Event Sourcing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../../architecture-overview/event-driven-microservices.html">
            
                <a href="../../../architecture-overview/event-driven-microservices.html">
            
                    
                    Event-Driven Microservices
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../../axon-server-introduction.html">
            
                <a href="../../../axon-server-introduction.html">
            
                    
                    Axon Server
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../../release-notes/">
            
                <a href="../../../release-notes/">
            
                    
                    Release Notes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../../release-notes/rn-axon-framework/">
            
                <a href="../../../release-notes/rn-axon-framework/">
            
                    
                    Axon Framework
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../../../release-notes/rn-axon-framework/rn-af-major-releases.html">
            
                <a href="../../../release-notes/rn-axon-framework/rn-af-major-releases.html">
            
                    
                    Major Releases
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../../../release-notes/rn-axon-framework/rn-af-minor-releases.html">
            
                <a href="../../../release-notes/rn-axon-framework/rn-af-minor-releases.html">
            
                    
                    Minor Releases
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../../release-notes/rn-axon-server/">
            
                <a href="../../../release-notes/rn-axon-server/">
            
                    
                    Axon Server
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="../../../release-notes/rn-axon-server/rn-as-major-releases.html">
            
                <a href="../../../release-notes/rn-axon-server/rn-as-major-releases.html">
            
                    
                    Major Releases
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.2" data-path="../../../release-notes/rn-axon-server/rn-asse-minor-releases.html">
            
                <a href="../../../release-notes/rn-axon-server/rn-asse-minor-releases.html">
            
                    
                    Minor Releases Standard Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.3" data-path="../../../release-notes/rn-axon-server/rn-as-minor-releases.html">
            
                <a href="../../../release-notes/rn-axon-server/rn-as-minor-releases.html">
            
                    
                    Minor Releases Enterprise Edition
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../../release-notes/axon-framework-extensions.html">
            
                <a href="../../../release-notes/axon-framework-extensions.html">
            
                    
                    Axon Framework Extensions
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Getting Started</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../../../getting-started/quick-start.html">
            
                <a href="../../../getting-started/quick-start.html">
            
                    
                    Quick Start
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Axon Framework</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../../introduction.html">
            
                <a href="../../introduction.html">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../../messaging-concepts/">
            
                <a href="../../messaging-concepts/">
            
                    
                    Messaging Concepts
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="../../messaging-concepts/anatomy-message.html">
            
                <a href="../../messaging-concepts/anatomy-message.html">
            
                    
                    Anatomy of a Message
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.2" data-path="../../messaging-concepts/message-correlation.html">
            
                <a href="../../messaging-concepts/message-correlation.html">
            
                    
                    Message Correlation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3" data-path="../../messaging-concepts/message-intercepting.html">
            
                <a href="../../messaging-concepts/message-intercepting.html">
            
                    
                    Message Intercepting
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.4" data-path="../../messaging-concepts/supported-parameters-annotated-handlers.html">
            
                <a href="../../messaging-concepts/supported-parameters-annotated-handlers.html">
            
                    
                    Supported Parameters for Annotated Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.5" data-path="../../messaging-concepts/exception-handling.html">
            
                <a href="../../messaging-concepts/exception-handling.html">
            
                    
                    Exception Handling
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.6" data-path="../../messaging-concepts/unit-of-work.html">
            
                <a href="../../messaging-concepts/unit-of-work.html">
            
                    
                    Unit of Work
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../../axon-framework-commands/">
            
                <a href="../../axon-framework-commands/">
            
                    
                    Commands
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="../../axon-framework-commands/modeling/">
            
                <a href="../../axon-framework-commands/modeling/">
            
                    
                    Modeling
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1.1" data-path="../../axon-framework-commands/modeling/aggregate.html">
            
                <a href="../../axon-framework-commands/modeling/aggregate.html">
            
                    
                    Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.2" data-path="../../axon-framework-commands/modeling/multi-entity-aggregates.html">
            
                <a href="../../axon-framework-commands/modeling/multi-entity-aggregates.html">
            
                    
                    Multi-Entity Aggregates
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.3" data-path="../../axon-framework-commands/modeling/state-stored-aggregates.html">
            
                <a href="../../axon-framework-commands/modeling/state-stored-aggregates.html">
            
                    
                    State Stored Aggregates
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.4" data-path="../../axon-framework-commands/modeling/aggregate-creation-from-another-aggregate.html">
            
                <a href="../../axon-framework-commands/modeling/aggregate-creation-from-another-aggregate.html">
            
                    
                    Aggregate Creation from another Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.5" data-path="../../axon-framework-commands/modeling/aggregate-polymorphism.html">
            
                <a href="../../axon-framework-commands/modeling/aggregate-polymorphism.html">
            
                    
                    Aggregate Polymorphism
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.6" data-path="../../axon-framework-commands/modeling/conflict-resolution.html">
            
                <a href="../../axon-framework-commands/modeling/conflict-resolution.html">
            
                    
                    Conflict Resolution
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="../../axon-framework-commands/command-dispatchers.html">
            
                <a href="../../axon-framework-commands/command-dispatchers.html">
            
                    
                    Command Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.3" data-path="../../axon-framework-commands/command-handlers.html">
            
                <a href="../../axon-framework-commands/command-handlers.html">
            
                    
                    Command Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.4" data-path="../../axon-framework-commands/infrastructure.html">
            
                <a href="../../axon-framework-commands/infrastructure.html">
            
                    
                    Infrastructure
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.5" data-path="../../axon-framework-commands/configuration.html">
            
                <a href="../../axon-framework-commands/configuration.html">
            
                    
                    Configuration
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../">
            
                <a href="../">
            
                    
                    Events
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.1" data-path="../event-dispatchers.html">
            
                <a href="../event-dispatchers.html">
            
                    
                    Event Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2" data-path="../event-handlers.html">
            
                <a href="../event-handlers.html">
            
                    
                    Event Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="3.4.3" data-path="./">
            
                <a href="./">
            
                    
                    Event Processors
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.3.1" data-path="subscribing.html">
            
                <a href="subscribing.html">
            
                    
                    Subscribing Event Processors
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.3.2" data-path="streaming.html">
            
                <a href="streaming.html">
            
                    
                    Streaming Event Processors
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4.4" data-path="../event-bus-and-event-store.html">
            
                <a href="../event-bus-and-event-store.html">
            
                    
                    Event Bus & Event Store
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.5" data-path="../event-versioning.html">
            
                <a href="../event-versioning.html">
            
                    
                    Event Versioning
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.6" data-path="../event-serialization.html">
            
                <a href="../event-serialization.html">
            
                    
                    Event Serialization
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="../../queries/">
            
                <a href="../../queries/">
            
                    
                    Queries
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.1" data-path="../../queries/query-processing.html">
            
                <a href="../../queries/query-processing.html">
            
                    
                    Query Processing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2" data-path="../../queries/query-dispatchers.html">
            
                <a href="../../queries/query-dispatchers.html">
            
                    
                    Query Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.3" data-path="../../queries/query-handlers.html">
            
                <a href="../../queries/query-handlers.html">
            
                    
                    Query Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.4" data-path="../../queries/implementations.html">
            
                <a href="../../queries/implementations.html">
            
                    
                    Implementations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.5" data-path="../../queries/configuration.html">
            
                <a href="../../queries/configuration.html">
            
                    
                    Configuration
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="../../sagas/">
            
                <a href="../../sagas/">
            
                    
                    Sagas
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.6.1" data-path="../../sagas/implementation.html">
            
                <a href="../../sagas/implementation.html">
            
                    
                    Implementation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.2" data-path="../../sagas/associations.html">
            
                <a href="../../sagas/associations.html">
            
                    
                    Associations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.3" data-path="../../sagas/infrastructure.html">
            
                <a href="../../sagas/infrastructure.html">
            
                    
                    Infrastructure
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="../../deadlines/">
            
                <a href="../../deadlines/">
            
                    
                    Deadlines
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.7.1" data-path="../../deadlines/deadline-managers.html">
            
                <a href="../../deadlines/deadline-managers.html">
            
                    
                    Deadline Managers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.2" data-path="../../deadlines/event-schedulers.html">
            
                <a href="../../deadlines/event-schedulers.html">
            
                    
                    Event Schedulers
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="../../testing/">
            
                <a href="../../testing/">
            
                    
                    Testing
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.8.1" data-path="../../testing/commands-events.html">
            
                <a href="../../testing/commands-events.html">
            
                    
                    Commands / Events
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.8.2" data-path="../../testing/sagas-1.html">
            
                <a href="../../testing/sagas-1.html">
            
                    
                    Sagas
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="../../tuning/">
            
                <a href="../../tuning/">
            
                    
                    Tuning
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.9.1" data-path="../../tuning/event-snapshots.html">
            
                <a href="../../tuning/event-snapshots.html">
            
                    
                    Event Snapshots
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9.2" data-path="../../tuning/event-processing.html">
            
                <a href="../../tuning/event-processing.html">
            
                    
                    Event Processing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9.3" data-path="../../tuning/command-processing.html">
            
                <a href="../../tuning/command-processing.html">
            
                    
                    Command Processing
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="../../monitoring-and-metrics.html">
            
                <a href="../../monitoring-and-metrics.html">
            
                    
                    Monitoring and Metrics
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="../../spring-boot-integration.html">
            
                <a href="../../spring-boot-integration.html">
            
                    
                    Spring Boot Integration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="../../modules.html">
            
                <a href="../../modules.html">
            
                    
                    Modules
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Axon Server</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../../../axon-server/introduction.html">
            
                <a href="../../../axon-server/introduction.html">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../../../axon-server/installation/">
            
                <a href="../../../axon-server/installation/">
            
                    
                    Installation
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1" data-path="../../../axon-server/installation/local-installation/">
            
                <a href="../../../axon-server/installation/local-installation/">
            
                    
                    Local Installation
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1.1" data-path="../../../axon-server/installation/local-installation/axon-server-se.html">
            
                <a href="../../../axon-server/installation/local-installation/axon-server-se.html">
            
                    
                    Axon Server SE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.1.2" data-path="../../../axon-server/installation/local-installation/axon-server-ee.html">
            
                <a href="../../../axon-server/installation/local-installation/axon-server-ee.html">
            
                    
                    Axon Server EE
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.2.2" data-path="../../../axon-server/installation/docker-k8s/">
            
                <a href="../../../axon-server/installation/docker-k8s/">
            
                    
                    Docker / K8s
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.2.1" data-path="../../../axon-server/installation/docker-k8s/axon-server-se.html">
            
                <a href="../../../axon-server/installation/docker-k8s/axon-server-se.html">
            
                    
                    Axon Server SE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.2.2" data-path="../../../axon-server/installation/docker-k8s/axon-server-ee.html">
            
                <a href="../../../axon-server/installation/docker-k8s/axon-server-ee.html">
            
                    
                    Axon Server EE
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../../../axon-server/administration/">
            
                <a href="../../../axon-server/administration/">
            
                    
                    Administration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1" data-path="../../../axon-server/administration/admin-configuration/">
            
                <a href="../../../axon-server/administration/admin-configuration/">
            
                    
                    Configuration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1.1" data-path="../../../axon-server/administration/admin-configuration/configuration.html">
            
                <a href="../../../axon-server/administration/admin-configuration/configuration.html">
            
                    
                    System Properties
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.1.2" data-path="../../../axon-server/administration/admin-configuration/command-line-interface.html">
            
                <a href="../../../axon-server/administration/admin-configuration/command-line-interface.html">
            
                    
                    Command Line Interface
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.1.3" data-path="../../../axon-server/administration/admin-configuration/rest-api.html">
            
                <a href="../../../axon-server/administration/admin-configuration/rest-api.html">
            
                    
                    REST API
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3.2" data-path="../../../axon-server/administration/monitoring/">
            
                <a href="../../../axon-server/administration/monitoring/">
            
                    
                    Monitoring
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.2.1" data-path="../../../axon-server/administration/monitoring/actuator-endpoints.html">
            
                <a href="../../../axon-server/administration/monitoring/actuator-endpoints.html">
            
                    
                    Actuator Endpoints
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.2.2" data-path="../../../axon-server/administration/monitoring/grpc-metrics.html">
            
                <a href="../../../axon-server/administration/monitoring/grpc-metrics.html">
            
                    
                    gRPC Metrics
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.2.3" data-path="../../../axon-server/administration/monitoring/heartbeat-monitoring.html">
            
                <a href="../../../axon-server/administration/monitoring/heartbeat-monitoring.html">
            
                    
                    Heartbeat Monitoring
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3.3" data-path="../../../axon-server/administration/clustering.html">
            
                <a href="../../../axon-server/administration/clustering.html">
            
                    
                    Clusters
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.4" data-path="../../../axon-server/administration/replication-groups.html">
            
                <a href="../../../axon-server/administration/replication-groups.html">
            
                    
                    Replication Groups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.5" data-path="../../../axon-server/administration/multi-context.html">
            
                <a href="../../../axon-server/administration/multi-context.html">
            
                    
                    Multi-Context
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.6" data-path="../../../axon-server/administration/tagging.html">
            
                <a href="../../../axon-server/administration/tagging.html">
            
                    
                    Tagging
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.7" data-path="../../../axon-server/administration/backup-and-messaging-only-nodes.html">
            
                <a href="../../../axon-server/administration/backup-and-messaging-only-nodes.html">
            
                    
                    Backup and Messaging-only Nodes
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.8" data-path="../../../axon-server/administration/backups.html">
            
                <a href="../../../axon-server/administration/backups.html">
            
                    
                    Backups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.9" data-path="../../../axon-server/administration/recovery.html">
            
                <a href="../../../axon-server/administration/recovery.html">
            
                    
                    Recovery
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.10" data-path="../../../axon-server/administration/plugins.html">
            
                <a href="../../../axon-server/administration/plugins.html">
            
                    
                    Plugins
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.11" data-path="../../../axon-server/administration/error-codes.html">
            
                <a href="../../../axon-server/administration/error-codes.html">
            
                    
                    Error Codes
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../../../axon-server/security/">
            
                <a href="../../../axon-server/security/">
            
                    
                    Security
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.1" data-path="../../../axon-server/security/ssl.html">
            
                <a href="../../../axon-server/security/ssl.html">
            
                    
                    SSL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.2" data-path="../../../axon-server/security/access-control.html">
            
                <a href="../../../axon-server/security/access-control.html">
            
                    
                    Access Control
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.3" data-path="../../../axon-server/security/access-control-se.html">
            
                <a href="../../../axon-server/security/access-control-se.html">
            
                    
                    Access Control - Standard Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.4" data-path="../../../axon-server/security/access-control-ee.html">
            
                <a href="../../../axon-server/security/access-control-ee.html">
            
                    
                    Access Control - Enterprise Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.5" data-path="../../../axon-server/security/access-control-clients.html">
            
                <a href="../../../axon-server/security/access-control-clients.html">
            
                    
                    Access Control - Client Applications
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.6" data-path="../../../axon-server/security/access-control-cli.html">
            
                <a href="../../../axon-server/security/access-control-cli.html">
            
                    
                    Access Control - CLI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.7" data-path="../../../axon-server/security/access-control-api.html">
            
                <a href="../../../axon-server/security/access-control-api.html">
            
                    
                    Access Control - API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.8" data-path="../../../axon-server/security/access-control-ldap.html">
            
                <a href="../../../axon-server/security/access-control-ldap.html">
            
                    
                    Access Control - LDAP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.9" data-path="../../../axon-server/security/access-control-oauth2.html">
            
                <a href="../../../axon-server/security/access-control-oauth2.html">
            
                    
                    Access Control - OAuth 2.0
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="../../../axon-server/performance/">
            
                <a href="../../../axon-server/performance/">
            
                    
                    Performance
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.5.1" data-path="../../../axon-server/performance/tuning-event-processing.html">
            
                <a href="../../../axon-server/performance/tuning-event-processing.html">
            
                    
                    Event Segments
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5.2" data-path="../../../axon-server/performance/flow-control.html">
            
                <a href="../../../axon-server/performance/flow-control.html">
            
                    
                    Flow Control
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="../../../axon-server/migration/">
            
                <a href="../../../axon-server/migration/">
            
                    
                    Migration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.6.1" data-path="../../../axon-server/migration/standard-to-enterprise-edition.html">
            
                <a href="../../../axon-server/migration/standard-to-enterprise-edition.html">
            
                    
                    Standard to Enterprise Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6.2" data-path="../../../axon-server/migration/non-axon-server-to-axon-server.html">
            
                <a href="../../../axon-server/migration/non-axon-server-to-axon-server.html">
            
                    
                    Non-Axon Server to Axon Server
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Extensions</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../../../extensions/spring-amqp.html">
            
                <a href="../../../extensions/spring-amqp.html">
            
                    
                    Spring AMQP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../../../extensions/jgroups.html">
            
                <a href="../../../extensions/jgroups.html">
            
                    
                    JGroups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../../../extensions/kafka.html">
            
                <a href="../../../extensions/kafka.html">
            
                    
                    Kafka
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../../../extensions/kotlin.html">
            
                <a href="../../../extensions/kotlin.html">
            
                    
                    Kotlin
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="../../../extensions/mongo.html">
            
                <a href="../../../extensions/mongo.html">
            
                    
                    Mongo
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="../../../extensions/reactor/reactor.html">
            
                <a href="../../../extensions/reactor/reactor.html">
            
                    
                    Reactor
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.6.1" data-path="../../../extensions/reactor/reactive-gateways/reactive-gateways.html">
            
                <a href="../../../extensions/reactor/reactive-gateways/reactive-gateways.html">
            
                    
                    Reactor Gateways
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="../../../extensions/spring-cloud.html">
            
                <a href="../../../extensions/spring-cloud.html">
            
                    
                    Spring Cloud
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.8" data-path="../../../extensions/tracing.html">
            
                <a href="../../../extensions/tracing.html">
            
                    
                    Tracing
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Appendices</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../../../appendices/rdbms-tuning.html">
            
                <a href="../../../appendices/rdbms-tuning.html">
            
                    
                    A. RDBMS Tuning
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../../../appendices/message-handler-tuning/">
            
                <a href="../../../appendices/message-handler-tuning/">
            
                    
                    B. Message Handler Tuning
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.2.1" data-path="../../../appendices/message-handler-tuning/parameter-resolvers.html">
            
                <a href="../../../appendices/message-handler-tuning/parameter-resolvers.html">
            
                    
                    Parameter Resolvers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2.2" data-path="../../../appendices/message-handler-tuning/handler-enhancers.html">
            
                <a href="../../../appendices/message-handler-tuning/handler-enhancers.html">
            
                    
                    Handler Enhancers
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../../../appendices/meta-annotations.html">
            
                <a href="../../../appendices/meta-annotations.html">
            
                    
                    C. Meta Annotations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../../../appendices/identifier-generation.html">
            
                <a href="../../../appendices/identifier-generation.html">
            
                    
                    D. Identifier Generation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="../../../appendices/query-reference.html">
            
                <a href="../../../appendices/query-reference.html">
            
                    
                    E. Axon Server Query Language
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >Event Processors</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="event-processors">Event Processors</h1>
<p><a href="../event-handlers.html">Event handlers</a> define the business logic to be performed when an event is received.
<em>Event Processors</em> are the components that take care of the technical aspects of that processing.
They start a <a href="../../messaging-concepts/unit-of-work.html">unit of work</a> and possibly a transaction.
However, they also ensure that <a href="../../monitoring-and-metrics.html#correlation-data-a-idcorrelation-dataa">correlation data</a> can be correctly attached to all messages created during event processing, among other non-functional requirements.</p>
<p>The image below depicts a representation of the organization of Event Processors and Event Handlers:</p>
<p><img src="../../../.gitbook/assets/event-processors.png" alt="Organization of Event Processors and Event Handlers"></p>
<p>Axon has a layered approach towards organizing event handlers.
First, an event handler is positioned in a <em>Processing Group</em>.
Each event handler, or &quot;Event Handling Component,&quot; will only ever belong to a single Processing Group.
The Processing Group provides a level of configurable non-functional requirements, like <a href="#processing-group-listener-invocation-error-handler">error handling</a> and the <a href="streaming.html#sequential-processing">sequencing policy</a>.</p>
<p>The Event Processors, in turn, is in charge of the Processing Group.
An Event Processor will control 1 to N Processing Groups, although there will be a one-to-one mapping in most cases.
Similar to the Event Handling Component, a Processing Group will belong to a single Event Processor.
This last layer allows the definition of the type of Event Processor used and concepts like the threading model and a more fine-grained degree of <a href="#event-processor-error-handler">error handling</a>.</p>
<p>Event Processors come in roughly two forms: <a href="subscribing.html">Subscribing</a> and <a href="streaming.html">Streaming</a>.</p>
<p>Subscribing Event Processors subscribe to a source of events and are invoked by the thread managed by the publishing mechanism.
Streaming Event Processors, on the other hand, pull their messages from a source using a thread that it manages itself.</p>
<p>For more specifics on either type, consult their respective sections <a href="subscribing.html">here</a> and <a href="streaming.html">here</a>.
The rest of this page dedicates itself to describing the Event Processor&apos;s common concepts and configuration options.
Note that throughout, the <code>EventProcessingConfigurer</code> is used.
The <code>EventProcessingConfigurer</code> is part of Axon&apos;s Configuration API, dedicated to configuring Event Processors.</p>
<h2 id="assigning-handlers-to-processors">Assigning handlers to processors</h2>
<p>All processors have a name, which identifies a processor instance across JVM instances.
Two processors with the same name are considered as two instances of the same processor.</p>
<p>All event handlers are attached to a processor whose name by default is the package name of the event handler&apos;s class.
Furthermore, the default processor implementation used by Axon is the <a href="streaming.html">Tracking Event Processor</a>.
The (default) event processor used can be adjusted, as is shown in the <a href="subscribing.html#configuring">subscribing</a> and <a href="streaming.html#configuring">streaming</a> sections.</p>
<p>Event handlers, or Event Handling Components, come in roughly two flavors: &quot;regular&quot; (singleton, stateless) event handlers and <a href="../../sagas/">sagas</a>.
<a href="../event-handlers.html#registering-event-handlers">This</a> section describes the process to register an event handler, whereas <a href="../../sagas/implementation.html#configuring-a-saga">this</a> page describes the saga registration process.</p>
<p>Now let us consider that the following event handlers have been registered:</p>
<ul>
<li><code>org.axonframework.example.eventhandling.MyHandler</code></li>
<li><code>org.axonframework.example.eventhandling.MyOtherHandler</code></li>
<li><code>org.axonframework.example.eventhandling.module.ModuleHandler</code></li>
</ul>
<p>Without any intervention, this will trigger the creation of two processors, namely:</p>
<ol>
<li><code>org.axonframework.example.eventhandling</code> with two handlers called <code>MyHandler</code> and <code>MyOtherHandler</code></li>
<li><code>org.axonframework.example.eventhandling.module</code> with the single handler <code>ModuleHandler</code></li>
</ol>
<p>Using the package name serves as a suitable default, but using dedicated names for an Event Processor and/or the Processing Group is recommended.
The most straightforward approach to reaching a transparent naming scheme of your event handlers is by using the <code>ProcessingGroup</code> annotation.
This annotation resembles the Processing Group level discussed in the <a href="./#event-processors">introduction</a>.</p>
<p>The <code>ProcessingGroup</code> annotation requires the insertion of a name and can only be set on the class.
Let us adjust the previous sample by using this annotation instead of the package names for grouping handlers:</p>
<pre><code class="lang-java"><span class="hljs-meta">@ProcessingGroup</span>(<span class="hljs-string">&quot;my-handlers&quot;</span>)
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyHandler</span> </span>{
    <span class="hljs-comment">// left out event handling functions...</span>
}

<span class="hljs-meta">@ProcessingGroup</span>(<span class="hljs-string">&quot;my-handlers&quot;</span>)
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyOtherHandler</span></span>{
    <span class="hljs-comment">// ...</span>
}

<span class="hljs-meta">@ProcessingGroup</span>(<span class="hljs-string">&quot;module-handlers&quot;</span>)
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ModuleHandler</span> </span>{
    <span class="hljs-comment">// ...</span>
}
</code></pre>
<p>Using the <code>ProcessingGroup</code> annotation as depicted, we again construct two processors:</p>
<ol>
<li><code>my-handlers</code> with two handlers called <code>MyHandler</code> and <code>MyOtherHandler</code></li>
<li><code>module-handlers</code> with the single handler <code>ModuleHandler</code></li>
</ol>
<p>If more control is required to group Event Handling Components, we recommend consulting the <a href="#event-handler-assignment-rules">assignment rules</a> section.</p>
<h3 id="event-handler-assignment-rules">Event Handler Assignment Rules</h3>
<p>The Configuration API allows you to configure other strategies for assigning event handling classes to processors or assigning specific handler instances to particular processors.
We can separate these assignment rules into roughly two groups: Event Handler to Processing Group and Processing Group to Event Processor.
Below is an exhaustive list of all the assignment rules the <code>EventProcessingConfigurer</code> exposes:</p>
<p><strong>Event Handler to Processing Group</strong></p>
<ul>
<li><code>byDefaultAssignTo(String)</code> - defines the default Processing Group name to assign an event handler to.
It will only be taken into account if there are no more specifics rules and if the <code>ProcessingGroup</code> annotation is not present.</li>
<li><code>byDefaultAssignHandlerInstancesTo(Function&lt;Object, String&gt;)</code> - defines a lambda invoked to assign an event handling instance to a desired Processing Group by returning that group&apos;s name.
It will only be taken into account if there are no more specifics rules and if the <code>ProcessingGroup</code> annotation is not present.</li>
<li><code>byDefaultAssignHandlerTypesTo(Function&lt;Class&lt;?&gt;, String&gt;)</code> - defines a lambda invoked to assign an event handler type to a desired Processing Group by returning that group&apos;s name.
It will only be taken into account if there are no more specifics rules and if the <code>ProcessingGroup</code> annotation is not present.</li>
<li><code>assignHandlerInstancesMatching(String, Predicate&lt;Object&gt;)</code> - assigns event handlers to the given Processing Group name based on a predicate ingesting an event handling instance.
The operation uses a natural priority of zero. If an instance matches several criteria, the outcome is <em>undefined</em>.</li>
<li><code>assignHandlerTypesMatching(String, Predicate&lt;Class&lt;?&gt;&gt;)</code> - assigns event handlers to the given Processing Group name based on a predicate ingesting an event handler type.
The operation uses a natural priority of zero. If an instance matches several criteria, the outcome is <em>undefined</em>.</li>
<li><code>assignHandlerInstancesMatching(String, int, Predicate&lt;Object&gt;)</code> -  assigns event handlers to the given Processing Group name based on a predicate ingesting an event handling instance.
Uses the given priority to decide on rule-ordering. The higher the priority value, the more important the rule is.
If an instance matches several criteria, the outcome is <em>undefined</em>.</li>
<li><code>assignHandlerTypesMatching(String, int, Predicate&lt;Class&lt;?&gt;&gt;)</code> - assigns event handlers to the given Processing Group name based on a predicate ingesting an event handler type.
Uses the given priority to decide on rule-ordering. The higher the priority, the more important the rule is.
If an instance matches several criteria, the outcome is <em>undefined</em>.</li>
</ul>
<p><strong>Processing Group to Event Processor</strong></p>
<ul>
<li><code>assignProcessingGroup(String, String)</code> - defines a given Processing Group name that belongs to the given Event Processor&apos;s name.</li>
<li><code>assignProcessingGroup(Function&lt;String, String&gt;)</code> - defines a lambda invoked to assign a Processing Group name to the desired Event Processor by returning that processor&apos;s name.</li>
</ul>
<h3 id="ordering-event-handlers-within-a-processor">Ordering Event Handlers within a processor</h3>
<p>To order event handlers within an Event Processor, the order in which event handlers are registered (as described in the <a href="../event-handlers.html#registering-event-handlers">Registering Event Handlers</a> section) is guiding.
Thus, the ordering in which an Event Processor will call event handlers for event handling is the same as their insertion ordering in the Configuration API.</p>
<p>If we use Spring as the mechanism for wiring everything, we can explicitly specify the event handler component ordering by adding the <code>@Order</code> annotation.
This annotation is placed on the event handler class name, containing an <code>integer</code> value to specify the ordering.</p>
<p>Note that it is <strong>not possible</strong> to order event handlers belonging to different Event Processors.
Each Event Processor acts as an isolated component without any intervention from other Event Processors.</p>
<blockquote>
<p><strong>Ordering Considerations</strong></p>
<p>Although we can place an order among event handlers within an Event Processor, separation of event handlers is recommended.</p>
<p>Placing an overall ordering on event handlers means those components are inclined to interact with one another, introducing a form of coupling.
Due to this, the event handling process will become complex to manage (e.g., for new team members).
Furthermore, embracing an ordering approach might lead to place <em>all</em> event handlers in a global ordering, decreasing processing speeds in general.</p>
<p>In all, you are free to use an ordering, but we recommend using it sparingly.</p>
</blockquote>
<h2 id="error-handling">Error Handling</h2>
<p>Errors are inevitable in any application.
Depending on where they happen, you may want to respond differently.</p>
<p>By default, exceptions raised by event handlers are caught in the <a href="#processing-group-listener-invocation-error-handler">Processing Group layer</a>, logged, and processing continues with the following events.
When an exception is thrown when a processor is trying to commit a transaction, update a <a href="streaming.html#token-store">token</a>, or in any other part of the process, the exception will be propagated.</p>
<p>In the case of a <a href="streaming.html#error-mode">Streaming Event Processor</a>, this means the processor will go into error mode, releasing any tokens and retrying at an incremental interval (starting at 1 second, up to max 60 seconds).
A <a href="subscribing.html#error-mode">Subscribing Event Processor</a> will report a publication error to the component that provided the event.</p>
<p>To change this behavior, both the Processing Group and Event Processor level allow customization on how to deal with exceptions:</p>
<h3 id="processing-group---listener-invocation-error-handler">Processing Group - Listener Invocation Error Handler</h3>
<p>The component dealing with exceptions thrown from an event handling method is called the <code>ListenerInvocationErrorHandler</code>.
By default, these exceptions are logged (with the <code>LoggingErrorHandler</code> implementation), and processing continues with the next handler or message.</p>
<p>The default <code>ListenerInvocationErrorHandler</code> used by each processing group can be customized.
Furthermore, we can configure the error handling behavior per processing group:</p>
<p> tabs 
 tab title=&quot;Axon Configuration API&quot; </p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AxonConfig</span> </span>{
    <span class="hljs-comment">// ...</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureProcessingGroupErrorHandling</span><span class="hljs-params">(EventProcessingConfigurer processingConfigurer)</span> </span>{
        <span class="hljs-comment">// To configure a default ...</span>
        processingConfigurer.registerDefaultListenerInvocationErrorHandler(conf -&gt; <span class="hljs-comment">/* create listener error handler */</span>)
                            <span class="hljs-comment">// ... or for a specific processing group: </span>
                            .registerListenerInvocationErrorHandler(<span class="hljs-string">&quot;my-processing-group&quot;</span>, conf -&gt; <span class="hljs-comment">/* create listener error handler */</span>);
    }
}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Spring Boot AutoConfiguration&quot; </p>
<pre><code class="lang-java"><span class="hljs-meta">@Configuration</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AxonConfig</span> </span>{
    <span class="hljs-comment">// ...</span>
    <span class="hljs-meta">@Autowired</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureProcessingGroupErrorHandling</span><span class="hljs-params">(EventProcessingConfigurer processingConfigurer)</span> </span>{
        <span class="hljs-comment">// To configure a default ...</span>
        processingConfigurer.registerDefaultListenerInvocationErrorHandler(conf -&gt; <span class="hljs-comment">/* create listener error handler */</span>)
                            <span class="hljs-comment">// ... or for a specific processing group: </span>
                            .registerListenerInvocationErrorHandler(<span class="hljs-string">&quot;my-processing-group&quot;</span>, conf -&gt; <span class="hljs-comment">/* create listener error handler */</span>);
    }
}
</code></pre>
<p> endtab 
 endtabs </p>
<p>It is easy to implement custom error handling behavior. 
The error handling method to implement provides the exception, the event that was handled, and a reference to the handler that was handling the message:</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">ListenerInvocationErrorHandler</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">onError</span><span class="hljs-params">(Exception exception, 
                 EventMessage&lt;?&gt; event, 
                 EventMessageHandler eventHandler)</span> <span class="hljs-keyword">throws</span> Exception</span>;
}
</code></pre>
<p>You can choose to retry, ignore or rethrow the exception.
The exception will bubble up to the <a href="#event-processor-error-handler">Event Processor level</a> when rethrown.</p>
<h3 id="event-processor---error-handler">Event Processor - Error Handler</h3>
<p>Exceptions occurring outside an event handler&apos;s scope, or have bubbled up from there, are handled by the <code>ErrorHandler</code>.
The default error handler is the <code>PropagatingErrorHandler</code>, which will rethrow any exceptions it catches.</p>
<p>How the Event Processor deals with a rethrown exception differ per implementation.
The behaviour for the Subscribing- and the Streaming Event Processor can respectively be found <a href="subscribing.html#error-mode">here</a> and <a href="streaming.html#error-mode">here</a>.</p>
<p>We can configure a default <code>ErrorHandler</code> for all Event Processors or an <code>ErrorHandler</code> for specific processors:</p>
<p> tabs 
 tab title=&quot;Axon Configuration API&quot; </p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AxonConfig</span> </span>{
    <span class="hljs-comment">// ...</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureProcessingGroupErrorHandling</span><span class="hljs-params">(EventProcessingConfigurer processingConfigurer)</span> </span>{
        <span class="hljs-comment">// To configure a default ...</span>
        processingConfigurer.registerDefaultErrorHandler(conf -&gt; <span class="hljs-comment">/* create error handler */</span>)
                            <span class="hljs-comment">// ... or for a specific processor: </span>
                            .registerErrorHandler(<span class="hljs-string">&quot;my-processor&quot;</span>, conf -&gt; <span class="hljs-comment">/* create error handler */</span>);
    }
}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Spring Boot AutoConfiguration&quot; </p>
<pre><code class="lang-java"><span class="hljs-meta">@Configuration</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AxonConfig</span> </span>{
    <span class="hljs-comment">// ...</span>
    <span class="hljs-meta">@Autowired</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureProcessingGroupErrorHandling</span><span class="hljs-params">(EventProcessingConfigurer processingConfigurer)</span> </span>{
        <span class="hljs-comment">// To configure a default ...</span>
        processingConfigurer.registerDefaultErrorHandler(conf -&gt; <span class="hljs-comment">/* create error handler */</span>)
                            <span class="hljs-comment">// ... or for a specific processor: </span>
                            .registerErrorHandler(<span class="hljs-string">&quot;my-processor&quot;</span>, conf -&gt; <span class="hljs-comment">/* create error handler */</span>);
    }
}
</code></pre>
<p> endtab 
 endtabs </p>
<p>For providing a custom solution, the <code>ErrorHandler</code>&apos;s single method needs to be implemented:</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">ErrorHandler</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">handleError</span><span class="hljs-params">(ErrorContext errorContext)</span> <span class="hljs-keyword">throws</span> Exception</span>;
}
</code></pre>
<p>Based on the provided <code>ErrorContext</code> object, you can decide to ignore the error, schedule retries, perform dead-letter-queue delivery, or rethrow the exception.</p>
<h2 id="general-processor-configuration">General processor configuration</h2>
<p>Alongside <a href="#assigning-handlers-to-processors">handler assignment</a> and <a href="#error-handling">error handling</a>, Event Processors allow configuration for other components too.
For <a href="subscribing.html#configuring">Subscribing</a> and <a href="streaming.html#configuring">Streaming</a> Event Processor specific options, their respective sections should be checked.
The remainder of this page will cover the generic configuration options for each Event Processor.</p>
<h3 id="event-processor-builders">Event Processor Builders</h3>
<p>The <code>EventProcessingConfigurer</code> provides access to a lot of configurable components for Event Processors.
Sometimes it is easier or preferable to provide an entire function to construct an Event Processor, however.
To that end, we can configure a custom <code>EventProcessorBuilder</code>:</p>
<pre><code class="lang-java"><span class="hljs-meta">@FunctionalInterface</span>
<span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">EventProcessorBuilder</span> </span>{

    <span class="hljs-comment">// Note: the `EventHandlerInvoker` is the component which holds the event handling functions.</span>
    <span class="hljs-function">EventProcessor <span class="hljs-title">build</span><span class="hljs-params">(String name, 
                         Configuration configuration, 
                         EventHandlerInvoker eventHandlerInvoker)</span></span>;
}
</code></pre>
<p>The <code>EventProcessorBuilder</code> functional interface provides the event processor&apos;s name, the <code>Configuration</code> and the <code>EventHandlerInvoker</code>, and requires returning an <code>EventProcessor</code> instance.
Note that any Axon component that an Event Processor requires (e.g., an <code>EventStore</code>) is retrievable from the <code>Configuration</code>.</p>
<p>The <code>EventProcessingConfigurer</code> provides two methods to configure an <code>EventProcessorBuilder</code>:</p>
<ol>
<li><code>registerEventProcessorFactory(EventProcessorBuilder)</code> - allows you to define a default factory method that creates event processors for which no explicit factories are defined</li>
<li><code>registerEventProcessor(String, EventProcessorBuilder)</code> - defines the factory method to use to create a processor with given <code>name</code></li>
</ol>
<h3 id="event-handler-interceptors">Event Handler Interceptors</h3>
<p>Since the Event Processor is the invoker of event handling methods, it is a spot to configure <a href="../../messaging-concepts/message-intercepting.html">Message Handler Interceptors</a> too.
Since Event Processors are dedicated to event handling, the <code>MessageHandlerInterceptor</code> is required to deal with an <code>EventMessage</code>.
Differently put, an <a href="../../messaging-concepts/message-intercepting.html#event-handler-interceptors">EventHandlerInterceptor</a> can be registered to Event Processors.</p>
<p>The <code>EventProcessingConfigurer</code> provides two methods to configure <code>MessageHandlerInterceptor</code> instances:</p>
<ul>
<li><code>registerDefaultHandlerInterceptor(BiFunction&lt;Configuration, String, MessageHandlerInterceptor&lt;? super EventMessage&lt;?&gt;&gt;&gt;)</code> - registers a default <code>MessageHandlerInterceptor</code> that will be configured on every Event Processor instance</li>
<li><code>registerHandlerInterceptor(String, Function&lt;Configuration, MessageHandlerInterceptor&lt;? super EventMessage&lt;?&gt;&gt;&gt;)</code> - registers a <code>MessageHandlerInterceptor</code> that will be configured for the Event Processor matching the given <code>String</code></li>
</ul>
<h3 id="message-monitors">Message Monitors</h3>
<p>Any Event Processor instance provides the means to contain a Message Monitor.
Message Monitors (discussed in more detail <a href="../../monitoring-and-metrics.html#metrics-a-idmetricsa">here</a>) allow for monitoring the flow of messages throughout an Axon application.
For Event Processors, the message monitor deals explicitly with the events flowing through the Event Processor towards the event handling functions.</p>
<p>The <code>EventProcessingConfigurer</code> provides two approaches towards configuring a <code>MessageMonitor</code>:</p>
<ul>
<li><code>registerMessageMonitor(String, Function&lt;Configuration, MessageMonitor&lt;Message&lt;?&gt;&gt;&gt;)</code> - registers the given <code>MessageMonitor</code> to the Event Processor matching the given <code>String</code></li>
<li><code>registerMessageMonitorFactory(String, MessageMonitorFactory)</code> - registers the given <code>MessageMonitorFactory</code> to construct a <code>MessageMonitor</code> for the Event Processor matching the given <code>String</code></li>
</ul>
<p>The <code>MessageMonitorFactory</code> provides a more fine-grained approach, used throughout the Configuration API, to construct a <code>MessageMonitor</code>:</p>
<pre><code class="lang-java"><span class="hljs-meta">@FunctionalInterface</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">MessageMonitorFactory</span> </span>{

    MessageMonitor&lt;Message&lt;?&gt;&gt; create(Configuration configuration, 
                                      Class&lt;?&gt; componentType, 
                                      String componentName);
}
</code></pre>
<p>We can use the <code>Configuration</code> to retrieve the required dependencies to construct the <code>MessageMonitor</code>.
The type and name reflect which infrastructure component the factory constructs a monitor for.
Whenever you use the <code>MessageMonitorFactory</code> to construct a <code>MessageMonitor</code> for an Event Processor, the factory expects the <code>componentType</code> to be an <code>EventProcessor</code> implementation.
The <code>componentName</code>, on the other hand, would resemble the name of the Event Processor.</p>
<h3 id="transaction-management">Transaction Management</h3>
<p>As components that deal with event handling, the Event Processor is a logical place to provide transaction configuration options.
Note that in the majority of the scenarios, the defaults will suffice.
This section simply serves to show these options to allow adjustment if the application requires it.</p>
<p>The first of these is the <code>TransactionManager</code>.
Axon uses the <code>TransactionManager</code> to attach a transaction to every <a href="../../messaging-concepts/unit-of-work.html">Unit of Work</a>.
Within a Spring environment, the <code>TransactionManager</code> defaults to a <code>SpringTransactionManager</code>, which uses Spring&apos;s <code>PlatformTransactionManager</code> under the hood.
In non Spring environments, it would be wise to build a <code>TransactionManager</code> implement if transaction management is required, of course.
Such an implementation only requires the definition of the <code>TransactionManager#startTransaction()</code> method.
To adjust the transaction manager for an Event Processor, the <code>registerTransactionManager(String, Function&lt;Configuration, TransactionManager&gt;)</code> on the <code>EventProcessingConfigurer</code> should be used.</p>
<p>Secondly, you can adjust the desired <code>RollbackConfiguration</code> per Event Processor.
It is the <code>RollbackConfiguration</code> that decide when a <a href="../../messaging-concepts/unit-of-work.html">Unit of Work</a> should rollback the transaction.
The default <code>RollbackConfiguration</code> is to rollback on any type of <code>Throwable</code>; the <a href="../../messaging-concepts/unit-of-work.html">Unit of Work</a> page describes the other options you can choose.
To adjust the default behaviour, the <code>registerRollbackConfiguration(String, Function&lt;Configuration, RollbackConfiguration&gt;)</code> function should be invoked on the <code>EventProcessingConfigurer</code>.</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../event-handlers.html" class="navigation navigation-prev " aria-label="Previous page: Event Handlers">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="subscribing.html" class="navigation navigation-next " aria-label="Next page: Subscribing Event Processors">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Event Processors","level":"3.4.3","depth":2,"next":{"title":"Subscribing Event Processors","level":"3.4.3.1","depth":3,"path":"axon-framework/events/event-processors/subscribing.md","ref":"axon-framework/events/event-processors/subscribing.md","articles":[]},"previous":{"title":"Event Handlers","level":"3.4.2","depth":2,"path":"axon-framework/events/event-handlers.md","ref":"axon-framework/events/event-handlers.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"axon-framework/events/event-processors/README.md","mtime":"2021-09-13T08:33:05.929Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-09-13T08:33:36.904Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

